package com.poorstu.web.studentApply;

import java.text.SimpleDateFormat;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.common.base.web.BaseAction;
import com.poorstu.manager.StudentManager;
import com.poorstu.model.LoadMod;

public class LoadApplyManagerAction extends BaseAction {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		try{
			int allUserId=(Integer)request.getSession().getAttribute("allUserId");
			StudentManager stuManager=(StudentManager)getBean("studentManager");
			List<LoadMod> loadList=stuManager.selectMyLoadApply(allUserId);
			
			for(int i=0;i<loadList.size();i++){
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			loadList.get(i).setStrloadTime(sdf.format(loadList.get(i).getLoadTime()));
			
			}
			request.setAttribute("loadList", loadList);
			
			return mapping.findForward("success");
		}
		catch(Exception e){
			e.printStackTrace();
			return mapping.findForward("failure");
		}
	}
	
	

}
